<template>



      <!-- 儿子组件 用来配置图表   发送请求 -->
      <LineChart :xData="xData" :yData="yData"></LineChart>

</template>

<script>
import LineChart from "@/components/line/LineChart.vue";
import { ordertotalReq } from "@/api/order.api";
import dayjs from "dayjs";
export default {
  components: {
    LineChart,
  },
  data() {
    return {
      xData: [],
      yData: [{ name: "订单量", data: [] }],
   
      //   date: [],

    };
  },
  created() {
    ordertotalReq().then((res) => {
      console.log(res);

      // 把时间转换成字符串
      this.xData = res.data.data.map((item) =>
        dayjs(item.orderTime).format("MM-DD HH:mm")
      );

      this.yData[0].data = res.data.data.map((item) => item.orderAmount);

      // this.draw();
    });
  },
};
</script>

<style lang="less" scoped>
</style>